package com.ruoyi.common.security.domain;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;
import java.util.Map;

/**
 * 登录用户身份权限
 *
 * @author ruoyi
 */
public class LoginUser extends User {
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    private Long userId;
    private String userCategory;
    private Map<String, Object> userExt;

    public LoginUser(String userCategory, Long userId, String username, String password, Map<String, Object> userExt, boolean enabled, boolean accountNonExpired,
                     boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.userId = userId;
        this.userCategory = userCategory;
        this.userExt = userExt;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserCategory() {
        return userCategory;
    }

    public void setUserCategory(String userCategory) {
        this.userCategory = userCategory;
    }

    public Map<String, Object> getUserExt() {
        return userExt;
    }

    public void setUserExt(Map<String, Object> userExt) {
        this.userExt = userExt;
    }
}
